<?php
/*'****************************************************************************\
    CHTML 0.2.1
 	Copyright (C) 2007, 2008 Alexey Ilyin

 	This library is free software; you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published
	by the Free Software Foundation; either version 2.1 of the License, or
	(at your option) any later version.

 	This library is distributed in the hope that it will be useful, but
	WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

 	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

\******************************************************************************/

class CProps {
    function CProps ($props = NULL) {
		$this->setProps($props);
    }
	/**
	 *  Appends arbitrary field list to the object.
	 * 	@param	$props  List (array) of fields.
	 */
	function setProps ($props) {
		if (is_object($props)) {
			$props = get_object_vars($props);
		}
        else {
            $this->parsePropStr($props); //<<<//
        }
		if (is_array($props)) {
			foreach ($props as $key => $value) {
				$this->$key = $value;
			}
		}
	}
	
	static function parsePropStr (&$props) {
        if (is_string($props)) {
            parse_str($props, $props);
        }
    }
}


?>